package uk.co.q3c.deplan.server.unit.domain.resource;

import java.util.Calendar;
import java.util.GregorianCalendar;

import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import uk.co.q3c.deplan.client.domain.resource.DefaultWorkingTime;

@Test
public class DefaultWorkingTime_UT {

	DefaultWorkingTime dwt;

	@BeforeClass
	public void beforeClass() {
		dwt = new DefaultWorkingTime();
	}

	public void getWorkingTime() {
		Calendar cal = GregorianCalendar.getInstance();
		// 4th Feb is a Monday
		cal.set(2008, 1, 4);
		Assert.assertEquals(dwt.getWorkingTime(cal.getTime()), 450);
		// Tue
		cal.set(2008, 1, 5);
		Assert.assertEquals(dwt.getWorkingTime(cal.getTime()), 450);
		// Wed
		cal.set(2008, 1, 6);
		Assert.assertEquals(dwt.getWorkingTime(cal.getTime()), 450);
		// Thu
		cal.set(2008, 1, 7);
		Assert.assertEquals(dwt.getWorkingTime(cal.getTime()), 450);
		// Fri
		cal.set(2008, 1, 8);
		Assert.assertEquals(dwt.getWorkingTime(cal.getTime()), 420);
		// Sat
		cal.set(2008, 1, 9);
		Assert.assertEquals(dwt.getWorkingTime(cal.getTime()), 0);
		// Sun
		cal.set(2008, 1, 10);
		Assert.assertEquals(dwt.getWorkingTime(cal.getTime()), 0);
	}
}